package com.lagou.controller;

import com.lagou.service.EmailService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 邮件微服务控制层类

 */
@RestController
@RequestMapping("/api/email")
public class EmailController {

    @Reference
    private EmailService emailService;

    /**
     * 发送邮件的方法
     * @param email 收件方邮箱
     * @param code 验证码
     * @return 发送结果
     */
    @GetMapping("/sendEmail/{email}/{code}")
    public boolean sendEmail(@PathVariable String email, @PathVariable String code) {
        return emailService.sendEmail(email, code);
    }
}
